/* Dump or view gcc tree structure hierarchy.


   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ 

#include "gml4gtk-plugin.h"

static void dump_tree_hierarchy_to_file (char *fname)
{
  g_graph *graph;

  graph = dot_plugin_common.top_graph;

  dot_plugin_common.dump (fname);

  return;
}

/* Public function to dump the gcc tree structure hierarchy.  */

void
dot_plugin_dump_tree_hierarchy (void)
{
  dot_plugin_common.init ();

  dump_tree_hierarchy_to_file ("dump-tree-hierarchy.dot");

  dot_plugin_common.finish ();

  return;
}


/* Public function to view the gcc tree structure hierarchy.  */

void
dot_plugin_view_tree_hierarchy (void)
{
  dot_plugin_common.init ();

  dump_tree_hierarchy_to_file (dot_plugin_common.temp_file_name);

  dot_plugin_common.show (dot_plugin_common.temp_file_name);

  dot_plugin_common.finish ();

  return;
}


/* Plugin callback function for PLUGIN_FINISH event.  */

void *
dot_plugin_callback_tree_hierarchy (void *gcc_data, void *user_data)
{
printf("%s()\n",__FUNCTION__);
  dot_plugin_dump_tree_hierarchy ();
  return NULL;
}

/* end */
